const MiniCssExtractPlugin = require('mini-css-extract-plugin');

const isProd = process.env.NODE_ENV === "production";
function cssHandle(type) {
    const baseCSS = [
        isProd ? {
            loader: MiniCssExtractPlugin.loader,
            options: {
                // publicPath: '../../'
            }
        } : 'vue-style-loader',
        {
            loader: 'css-loader',
            options: {
                sourceMap: !isProd
            }
        },
        'postcss-loader'
    ];
    if (type === 'scss') baseCSS.push({
        loader: 'sass-loader',
        options: {
            sourceMap: !isProd
        }
    });
    return baseCSS;
}
module.exports = {
    isProd,
    cssHandle
}